package thread;

public class ThPingPongExtTH extends Thread {
    String palavra;
    long tempo;
    public ThPingPongExtTH(String palavra,long tempo){
        this.palavra = palavra;
        this.tempo = tempo;
    }
    @Override
    public void run(){
        try {
            for(int i = 0;i<10;i++){
                System.out.print(palavra + "-->");
                Thread.sleep(tempo);
            }
        } catch (InterruptedException e) {
        }
    }
    
    public static void main(String[] args){
        System.out.println("Antes de instanciar as Threads");
        new ThPingPongExtTH("Ping", 1500).start();
        new ThPingPongExtTH("Pong", 2000).start();
        System.out.println("Depois de instanciar as Threads");
    }
    
}
